package ua.com.stormlabs.tiny.licenseserver.service;

import org.springframework.transaction.annotation.Transactional;
import ua.com.stormlabs.tiny.licenseserver.beans.License;
import ua.com.stormlabs.tiny.licenseserver.storage.DuplicateLicenseException;
import ua.com.stormlabs.tiny.licenseserver.storage.LicenseNotFoundException;
import ua.com.stormlabs.tiny.licenseserver.storage.RequestResult;

import java.util.List;

/**
 * @author Maxim Bondarenko
 * @version 1.0 12/18/11
 */

@Transactional(readOnly = true)
public interface LicensesService {

    RequestResult<License> listLicenses(int pageNumber, int pageSize);

    @Transactional
    License createLicense(String licenseName) throws DuplicateLicenseException;

    License getLicenseById(int id) throws LicenseNotFoundException;

    License getLicenseByName(String licenseName) throws LicenseNotFoundException;

    @Transactional
    void deleteLicenseById(int id) throws LicenseNotFoundException;

    List<License> listAllLicenses();
}
